
using System.Web.UI.HtmlControls;
using System;
using System.Configuration;
using System.Drawing;
using System.Data;
using System.Web.UI.WebControls;
using Microsoft.VisualBasic;
using System.Collections;
using System.Web.UI;
using System.Web;


using System.IO;
using System.Text;
//using com.ddsc.database;
using DDSC.OracleADO;
using com.ddsc.common;
using SMAS;
using System.Resources;

namespace smasb2b
{
	public class CLASS_DESC : BasePage
	{
		
#region  Web Form 設計工具產生的程式碼
		
		//此為 Web Form 設計工具所需的呼叫。
		[System.Diagnostics.DebuggerStepThrough()]private void InitializeComponent()
		{
			
		}
		protected System.Web.UI.WebControls.Label lblINVOICES_AMT;
		protected System.Web.UI.WebControls.Label lblPAY_DATE;
		protected System.Web.UI.HtmlControls.HtmlTable DataGrid;
		protected System.Web.UI.WebControls.Label lblB2B_CLASS_CODE;
		protected System.Web.UI.WebControls.Label lblDESCRIPTION_CHINESE;
		
		//注意: 下列預留位置宣告是 Web Form 設計工具需要的項目。
		//請勿刪除或移動它。
		private System.Object designerPlaceholderDeclaration;
		
		private void Page_Init(System.Object sender, System.EventArgs e)
		{
			//CODEGEN: 此為 Web Form 設計工具所需的方法呼叫
			//請勿使用程式碼編輯器進行修改。
			InitializeComponent();
		}
		
#endregion
		VENDOR LoginUser;
		private void Page_Load(System.Object sender, System.EventArgs e)
		{
			try
			{
				DataGrid_DataBind();
			}
			catch (Exception ex)
			{
				showException(ex.Message);
			}
		}
		
		public void DataGrid_DataBind()
		{
			//變數宣告
			
			DataSet ds = default(DataSet);
			//dbAccess dba = new dbAccess();
            //Ken : 0.Modify local variables
            dbAccess dba = new dbAccess();
            //ArrayList m_arrParam = new ArrayList();
            string strCondition;
			int i;
			int count = 2;
			string[] str_SQL_a = new string[count + 1];
			string[] str_SQL_b = new string[count + 1];
			
			try
			{
				
				
				//預設查詢語法
				StringBuilder SqlCommandText = new StringBuilder();
				SqlCommandText.Append(" select * FROM VND_B2B_CLASS  ");
				
				//執行資料庫語法
				ds = dba.runExecuteQuery("VND_B2B_CLASS", SqlCommandText.ToString());
                //ds = dba.runExecuteQuery("VND_B2B_CLASS", SqlCommandText.ToString(),m_arrParam);
				if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
				{
					HtmlTableRow tr = (HtmlTableRow) (DataGrid.FindControl("DataGrid_head"));
					ArrayList ArrKey = new ArrayList();
					
					
					DataGrid_Bind_VND_B2B_CLASS(DataGrid, ds.Tables["VND_B2B_CLASS"]);
					
				}
				else
				{
					showException("查無搜尋資料!");
				}
				
			}
			catch (Exception ex)
			{
				throw (ex);
			}
			finally
			{
				ds.Dispose();
			}
		}
		
		public void DataGrid_Bind_VND_B2B_CLASS(HtmlTable DataGrid, DataTable DataSource)
		{
			
			HtmlTableRow tr = (HtmlTableRow) (DataGrid.FindControl("DataGrid_head"));
			int i = 0;
			int j = 0;
			int k;
			string Url;
			string className = "";
			ResourceManager rm = GetResourceManager();
			try
			{
				for (i = 0; i <= DataSource.Rows.Count - 1; i++)
				{
					HtmlTableRow htr = new HtmlTableRow();
					if (i % 2 == 0)
					{
						className = "evenRow";
					}
					else
					{
						className = "oddRow";
					}
					htr.Attributes.Add("class", className);
					DataGrid.Rows.Add(htr);
					for (j = 0; j <= tr.Cells.Count - 1; j++)
					{
						HtmlTableCell hd = new HtmlTableCell();
						
						switch (tr.Cells[j].Attributes["class"].ToLower())
						{
							case "tdtitle":
								hd.Width = tr.Cells[j].Width;
								hd.Align = "center";
								hd.Attributes.Add("class", "detail");
								if (tr.Cells[j].Controls[1].ID.Replace("lbl", "") == "DESCRIPTION_CHINESE")
								{
									if (Session["langauage"] == "zh-tw")
									{
										hd.InnerText = DataSource.Rows[i]["DESCRIPTION_CHINESE"].ToString();
									}
									else
									{
										hd.InnerText = DataSource.Rows[i]["DESCRIPTION_ENGLISH"].ToString();
									}
								}
								else
								{
									hd.InnerText = DataSource.Rows[i][tr.Cells[j].Controls[1].ID.Replace("lbl", "")].ToString();
								}
								break;
								
								
							default:
								hd.Width = tr.Cells[j].Width;
								hd.InnerText = rm.GetString(tr.Cells[j].ID);
								break;
						}
						DataGrid.Rows[DataGrid.Rows.Count - 1].Cells.Add(hd);
						
					}
				}
			}
			catch (Exception ex)
			{
				throw (ex);
			}
		}
	}
	
}
